package internal
//
//import (
//	"fmt"
//	"strconv"
//	"strings"
//
//	"game-server/base"
//	"game-server/log"
//	"game-server/msg"
//)
//
//func init() {
//	//skeleton.RegisterCommand("echo", "echo user inputs", commandEcho)
//	//skeleton.RegisterCommand("poker", "set poker. as roomNo roundId userId 105,105,305,005,205,008,210,101,001,103,106,107,213", commandPoker)
//	//skeleton.RegisterCommand("del", "del user/room/poker id", commandDel)
//	//skeleton.RegisterCommand("memory", "memory add/del roomList/roomOver/pokerList/pokerOver id", commandMemory)
//}
//
//func commandEcho(args []interface{}) interface{} {
//	return fmt.Sprintf("%v", args)
//}
//
//
//func commandDel(args []interface{}) interface{} {
//	param1 := args[0].(string)
//	param2, _ := strconv.ParseInt(args[1].(string), 10, 64)
//	iNum := int32(param2)
//
//	if param1 == "user" {
//		log.Debug("Cmd: delete user = ", base.Get(param1, iNum))
//		base.Delete(param1, iNum)
//		log.Debug("Cmd: delete user = ", base.Get(param1, iNum))
//	} else {
//		room := base.Get(param1, iNum).(base.Pk)
//		for _, v := range room.Players {
//			isEXist := base.IsExist("user", v.PlayerId)
//			baseCard := room.Round / 10
//			if isEXist {
//				userInfo := base.Get("user", v.PlayerId).(base.UserInfo)
//				userInfo.RoomNo = 0
//
//				//if room.PayAll {
//				//	if userInfo.Master {
//				//		userInfo.Cards += room.Person * baseCard
//				//	}
//				//} else {
//				//	userInfo.Cards += baseCard
//				//}
//				base.Put("user", v.PlayerId, userInfo)
//			}
//		}
//		base.Delete("room", iNum)
//
//		// 更新房间号
//		log.Debug("Cmd: delete RoomList = ", base.RoomList)
//		for k, v := range base.RoomList {
//			if v == iNum {
//				kk := k + 1
//				base.RoomList = append(base.RoomList[:k], base.RoomList[kk:]...)
//				break
//			}
//		}
//		log.Debug("Cmd: delete RoomList = ", base.RoomList)
//	}
//
//	return fmt.Sprint("del "+param1+"  = ", iNum)
//}
//
//func commandMemory(args []interface{}) interface{} {
//	param := args[0].(string)
//	param2, _ := strconv.ParseInt(args[2].(string), 10, 64)
//	param3 := args[1].(string)
//	iNum := int32(param2)
//
//	if param == "add" {
//		if param3 == "roomList" {
//			log.Debug("Cmd: add memory = ", base.RoomList)
//			base.RoomList = append(base.RoomList, iNum)
//			log.Debug("Cmd: add memory = ", base.RoomList)
//		}
//		if param3 == "roomOver" {
//			log.Debug("Cmd: add memory = ", base.RoomOver)
//			base.RoomOver = append(base.RoomOver, iNum)
//			log.Debug("Cmd: add memory = ", base.RoomOver)
//		}
//		if param3 == "pokerList" {
//			log.Debug("Cmd: add memory = ", base.PokerList)
//			base.PokerList = append(base.PokerList, iNum)
//			log.Debug("Cmd: add memory = ", base.PokerList)
//		}
//		if param3 == "pokerOver" {
//			log.Debug("Cmd: add memory = ", base.PokerOver)
//			base.PokerOver = append(base.PokerOver, iNum)
//			log.Debug("Cmd: add memory = ", base.PokerOver)
//		}
//	}
//
//	if param == "del" {
//		if param3 == "roomList" {
//			log.Debug("Cmd: del memory = ", base.RoomList)
//			for k, v := range base.RoomList {
//				if v == iNum {
//					kk := k + 1
//					base.RoomList = append(base.RoomList[:k], base.RoomList[kk:]...)
//					break
//				}
//			}
//			log.Debug("Cmd: del memory = ", base.RoomList)
//			log.Debug("Cmd: del memory room = ", base.Get("room", iNum))
//			base.Delete("room", iNum)
//			log.Debug("Cmd: del memory room = ", base.Get("room", iNum))
//		}
//		if param3 == "roomOver" {
//			log.Debug("Cmd: del memory = ", base.RoomOver)
//			for k, v := range base.RoomOver {
//				if v == iNum {
//					kk := k + 1
//					base.RoomOver = append(base.RoomOver[:k], base.RoomOver[kk:]...)
//					break
//				}
//			}
//			log.Debug("Cmd: del memory = ", base.RoomOver)
//		}
//		if param3 == "pokerList" {
//			log.Debug("Cmd: del memory = ", base.PokerList)
//			for k, v := range base.PokerList {
//				if v == iNum {
//					kk := k + 1
//					base.PokerList = append(base.PokerList[:k], base.PokerList[kk:]...)
//					break
//				}
//			}
//			log.Debug("Cmd: del memory = ", base.PokerList)
//			log.Debug("Cmd: del memory poker = ", base.Get("poker", iNum))
//			base.Delete("poker", iNum)
//			log.Debug("Cmd: del memory poker = ", base.Get("poker", iNum))
//		}
//		if param3 == "pokerOver" {
//			log.Debug("Cmd: del memory = ", base.PokerOver)
//			for k, v := range base.PokerOver {
//				if v == iNum {
//					kk := k + 1
//					base.PokerOver = append(base.PokerOver[:k], base.PokerOver[kk:]...)
//					break
//				}
//			}
//			log.Debug("Cmd: del memory = ", base.PokerOver)
//		}
//	}
//
//	return fmt.Sprint(param+param3+" = ", iNum)
//}
